package javaTest02.exercise_2;

import javaTest02.utils.Person;
import javaTest02.utils.LogMethodInvoke;
import javaTest02.utils.SettablePerson;


public class PersonProxy implements SettablePerson {
    private Person person;
    private final String PATH="src/javaTest02/exercise_2/out/log.txt";

    public PersonProxy(Person person){
        this.person=person;
        log("constructor",new String[]{"person"});
    }

    public void setName(String name) {
        this.person.setName(name);
        log("setName",new String[]{name});
    }

    public void setGender(String gender) {
        this.person.setGender(gender);
        log("setGender",new String[]{gender});
    }

    public void setAge(int age) {
        this.person.setAge(age);
        log("setAge",new String[]{String.valueOf(age)});
    }

    public void setWeight(double weight) {
        this.person.setWeight(weight);
        log("setWeight",new String[]{String.valueOf(weight)});
    }

    public void setHeight(double height) {
        this.person.setHeight(height);
        log("setHeight",new String[]{String.valueOf(height)});
    }

    public void setAddress(String address) {
        this.person.setAddress(address);
        log("setAddress",new String[]{address});
    }

    private void log(String methodName,String[] args) {
        LogMethodInvoke.log(methodName,args,PATH);
    }

}
